import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = []

// 同步读取./module下所有以js结尾的文件
const modules = import.meta.globEager('./module/*.js')

for (const path in modules) {
  routes.push(...modules[path].default)
}

const router = new VueRouter({
  mode: 'history',
  base: import.meta.env.BASE_URL,
  routes
})

export default router
